|
![](/i/fill.gif) |
I would like to read data (float or vectors of float) from an ascii file and use
the data as coordinates for the geometry in the scene: some spheres connected by
cylinders.
I tried with the following code and an input file with a sequence of floats.
The problem is that some data in the input file are not read (I checked with the
#write): sometimes every second float is read, sometimes there is no regular
pattern. Moreover, sometimes the minus sign is not read.
(I got a similar error with vectors of floats)
Am I doing something wrong or is there a bug in the I/O functions?
I'm using povray-3.6.1-12 on ubuntu 9.04 but I get the same error in windows
both with 3.6.1 and 3.6.2.
Thanks
Ester
#fopen inputfile "in.dat" read
//#fopen outputfile "out.dat" write
#if (defined(inputfile))
#read (inputfile, y1, y2, y3)
#end
#while (defined(inputfile))
#declare x1 = y1;
#declare x2 = y2;
#declare x3 = y3;
#read (inputfile, y1,y2,y3)
sphere { <x1,x2,x3>, 0.3 pigment {color Green}}
#if (!(x1 = y1 & x2 = y2 & x3 = y3))
cylinder { <x1,x2,x3>, <y1,y2,y3>, 0.1 pigment {color Red}}
#end
// #write (outputfile, x1, " ", x2, " ", x3, "\n")
#end
#fclose inputfile
//#fclose outputfile
Post a reply to this message
|
![](/i/fill.gif) |